﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;

namespace SaveAvailableData
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        static void Main()
        {
            //ServiceBase[] ServicesToRun;
            //ServicesToRun = new ServiceBase[] 
            //{ 
            //    new MainService() 
            //};
            //ServiceBase.Run(ServicesToRun);
            
            Queue<string> FileList = new Queue<string>(40*1024*1024 );
            /*
            System.Diagnostics.Debug.WriteLine("先遍历再检索：");
            System.Diagnostics.Debug.WriteLine(string.Format("开始时间：{0}",DateTime.Now));
            CSource.GetLatestFileList0(string.Format(@"D:\"), ref FileList, "cs");
            System.Diagnostics.Debug.WriteLine(FileList.Count.ToString());
            while (FileList.Count > 0)
            {
                Console.WriteLine(FileList.Dequeue());
            }
            System.Diagnostics.Debug.WriteLine(string.Format("结束时间：{0}", DateTime.Now));
            
            FileList.Clear();
            System.Diagnostics.Debug.WriteLine("遍历同时检索：");
            System.Diagnostics.Debug.WriteLine(string.Format("开始时间：{0}", DateTime.Now));
            CSource.GetLatestFileList(string.Format(@"D:\TeeChart.WPF"), ref FileList, "bmp");
            System.Diagnostics.Debug.WriteLine(FileList.Count.ToString());
            while (FileList.Count > 0)
            {
                //System.IO.FileInfo fi = new System.IO.FileInfo(FileList.Dequeue());
                //string strName=fi.Name.Replace("Steema.TeeChart.WPF.", "");
                //string strPath = string.Format("{0}\\{1}", fi.DirectoryName, (strName.Split('.'))[0] );
                //if (!System.IO.Directory.Exists(strPath))
                //{
                //    System.IO.Directory.CreateDirectory(strPath);
                //}
                //fi.MoveTo(string.Format("{0}\\{1}",strPath,strName.Substring(strName.IndexOf('.')+1)));
            }
            */
            System.Diagnostics.Debug.WriteLine(string.Format("结束时间：{0}", DateTime.Now));
            
            Console.ReadKey();

        }
    }
}
